﻿using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;

namespace DataTienda
{
    /// <summary>
    /// Class ErrorMessage.
    /// </summary>
    [DataContract]
    public class ErrorMessage
    {
        #region Fields

        /// <summary>
        /// The _error type
        /// </summary>
        private ErrorType _errorType;
        /// <summary>
        /// The _error text
        /// </summary>
        private string _errorText;
        /// <summary>
        /// The _error property
        /// </summary>
        private string _errorProperty;

        #endregion

        #region Constructor
        /// <summary>
        /// Initializes a new instance of the <see cref="ErrorMessage"/> class.
        /// </summary>
        /// <param name="errorText">The error text.</param>
        /// <param name="errorType">Type of the error.</param>
        /// <param name="errorProperty">The error property.</param>
        [SuppressMessage("Microsoft.Design", "CA1026")]
        public ErrorMessage(string errorText, ErrorType errorType, string errorProperty = null)
        {
            _errorText = errorText;
            _errorType = errorType;
            _errorProperty = errorProperty;
        }

        #endregion

        #region Properties

        /// <summary>
        /// Gets or sets the type of the error.
        /// </summary>
        /// <value>The type of the error.</value>
        [DataMember]
        public ErrorType ErrorType
        {
            get { return _errorType; }
            set { _errorType = value; }
        }

        /// <summary>
        /// Gets or sets the error text.
        /// </summary>
        /// <value>The error text.</value>
        [DataMember]
        public string ErrorText
        {
            get { return _errorText; }
            set { _errorText = value; }
        }

        /// <summary>
        /// Gets or sets the error property.
        /// </summary>
        /// <value>The error property.</value>
        [DataMember]
        public string ErrorProperty
        {
            get { return _errorProperty; }
            set { _errorProperty = value; }
        }

        #endregion
    }
}
